﻿//通用模板JS
$(function () {
    var fn = ABUS.Fn;
    var $el = $('#clerkWaiting');
    var listData = [];

    //页面滚动
    document.addEventListener('touchmove', function (e) {
        e.preventDefault();
        isDrag = true;
    }, {passive: false});

    $(document.body).on("touchmove", ".details_list",function (e) {
        e.stopPropagation();
    });
    fn.get({
        url:"/common/message",
        success:function (data) {
            if (data.result === 1) {
                $('#notice').renderTemp(data);
            } else {
                fn.alert({
                    type: "error",
                    title: data.message
                })
            }
        }
    });
    fn.get({
        url: "/user/order/waitingChildOrders",
        data: {
            "searchValue": ""
        },
        success: function (data) {
            if (data.result === 1) {
                listData = data.data;
                $el.find('.order_list ul').renderTemp(data);
                new IScroll('#order_list', {mouseWheel: true});

            } else {
                fn.alert({
                    type: "error",
                    title: data.message
                })
            }
        }
    });

    $("#order_list").on("touchend", "li", function () {
        if (isDrag) {
            isDrag = false;
            return true;
        }

        var data = listData[$(this).index()];
        data.time = $(this).find('.car4').text();
        fn.page_goto({
            url: "./yewuyuan_shouye_progress.html",
            data: data
        })
    });
    $(".search").on("touchend", function () {
        fn.page_goto({
            url: "./yewuyuan_shouye_search.html"
        })
    });
});